package com.uiao.stone.common.filter;

import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

@Order(3)
@Component
public class BFilter implements Filter {

    final static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BFilter.class);

    @Override
    public void init(FilterConfig filterConfig) {
        logger.info("BFilter 初始化 ==>>");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        logger.info("enter BFilter before ==>>");
        chain.doFilter(request, response);
        logger.info("enter BFilter after ==>>");
    }

    @Override
    public void destroy() {
        logger.info("BFilter 销毁 ==>>");
    }
}
